<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  "use strict"; {
    let arr1 = [0, 1];
    let arr2 = [2, 3, 4];
    const calc = (arr1, arr2) => {
      let res = [];
      for (let [key, value] of arr1.entries()) {
        for (let [index, item] of arr2.entries()) {
          res.push(`${value}_${item}`);
        };
      };
      return res;
    };
    let res = calc(arr1, arr2);
    console.log(JSON.stringify(res, null, 2));
  };
</script>

</html>